#ifndef _APP_LVGL_H
#define _APP_LVGL_H

#include "stdint.h"
#include "stdbool.h"

/* Maximal horizontal and vertical resolution to support by the library.*/

//#define DISPLAY_TYPE_GC9C01
//#define DISPLAY_TYPE_JD9854
//#define DISPLAY_TYPE_SH8601A
//#define DISPLAY_TYPE_ICNA3310
//#define DISPLAY_TYPE_SH8601Z
//#define DISPLAY_TYPE_NV3047_RGB //272x480  rgb
//#define DISPLAY_TYPE_ST7701_RGB //480x480 rgb
//#define DISPLAY_TYPE_NV3041A //272x480  8080
//#define DISPLAY_TYPE_ST2568_RGB //800x480 rgb
#define DISPLAY_TYPE_ST7282_RGB_HW

#ifdef DISPLAY_TYPE_NV3047_RGB
#define LV_HOR_RES_MAX          (272)
#define LV_VER_RES_MAX          (480)
#endif
#ifdef DISPLAY_TYPE_ST7701_RGB
#define LV_HOR_RES_MAX          (480)
#define LV_VER_RES_MAX          (480)
// #define LV_HOR_RES_MAX          (360)
// #define LV_VER_RES_MAX          (640)
#endif
#ifdef DISPLAY_TYPE_ST2568_RGB
#define LV_HOR_RES_MAX          (800)
#define LV_VER_RES_MAX          (480)
#endif

#ifdef DISPLAY_TYPE_ST7282_RGB_HW
#define LV_HOR_RES_MAX          (480)
#define LV_VER_RES_MAX          (272)
#endif

typedef struct
{
    uint16_t msg_type;
    uint16_t param_len;
    uint8_t  param[32 - 4];

}gui_task_msg_t;

typedef enum
{
    BUTTON_KEY_EVT = 0,
    ENCODE_KEY_EVT,
    BUTTON_KEY1_EVT,
    BUTTON_KEY2_EVT,
	BUTTON_KEY3_EVT,
	BUTTON_KEY4_EVT,
	BUTTON_KEY5_EVT,
    MESSAGE_IN_EVT,
    PHONE_CALL_IN_EVT,
    PHONE_CALL_OK_EVT,
    PHONE_CALL_REJECT_EVT,
    MUSIC_CONTROL_EVT,
    POWER_CHARGE_IN_EVT,
    POWER_CHARGE_OUT_EVT,
    SCREENSAVER_IN_EVT,

}user_msg_type_t;



typedef void (*ipc_tx_callback)(uint8_t chn);

void app_lvgl_init(void);

void lv_disp_draw_buf_sw(bool sw);

int gui_task_msg_send(uint16_t msg_type,
                    void *header,
                    uint16_t header_length,
                    uint8_t *payload,
                    uint16_t payload_length,
                    ipc_tx_callback callback);

void gui_task_queue_callback(gui_task_msg_t * event);

bool gui_task_suspend_state(void);

void gui_task_suspend(void);

bool gui_task_resume(void);

void * gui_task_handle_is_active(void);

#endif  // _APP_LVGL_H
